<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>特殊配送信息登记</title>
	<link id="easyuiTheme" rel="stylesheet" type="text/css" href="../jquery-easyui-1.5.3/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../jquery-easyui-1.5.3/themes/icon.css"/>
	<script src="../resources/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.5.3/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.5.3/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
	    var contextPath = function() {
	        return  "/" + location.pathname.split("/")[1];
	    }
	    
		function getValue(name){
			var str=window.location.search;
			if (str.indexOf(name)!=-1){
				var pos_start=str.indexOf(name)+name.length+1;
				var pos_end=str.indexOf("&",pos_start);
				if (pos_end==-1){
					return str.substring(pos_start);
				} else {
					return str.substring(pos_start,pos_end);
				}
			} else {
				return "";
			}
		}
		
		var  themeName = getValue("theme");
		if (themeName!=""){
		    var cssurl  = $('#easyuiTheme').attr('href');  
		    var href = cssurl.substring(0, cssurl.indexOf('themes')) + 'themes/' + themeName + '/easyui.css';  
		    $('#easyuiTheme').attr('href', href);  
		}
	</script>


<style>
<!--
body{
	background-image:url(NoteForm/wood-bg2.jpg);
}

.exlist{
	background-color:#F9EE70;
	margin:30px auto;
	padding:5px;
	width:680px;
	min-height:200px;
	height:auto;
	font-family:"微软雅黑";
	-webkit-box-shadow:4px 4px 5px #333;/*webkit*/ 
	-moz-box-shadow:4px 4px 5px #333;/*firefox*/     
	box-shadow:4px 4px 5px #333;/*opera或ie9*/ 
}

#title{
	width:200px;
	margin:20px auto;
}

#title legend{
	font-size:26px;
}

div.exlist_title{
	background-color:#F9EE70;
	width:680px;
	height:20px;
}

div.exlist_title img{
	float:right;
	margin:-15px 10px;
}

/*-----------form-----------*/

fieldset{
	width:90%;
	border:1px dashed #666;
	margin:40px auto;
}
 
legend{
	background-color:#F9EE70;
	height:120px;
	height:30px;
	color:#630;
	font-weight:bolder;
	font-size:20px;
	line-height:30px;
	margin:-20px 10px 10px;
	padding:0 10px;
}
  
 
div.row{
	margin:10px;
	padding:5px;
}
 
div.row label{
	height:20px;
	font-size:16px;
	line-height:20px;
	margin:0 10px;
}
 
input.txt{
	background-color:#F9EE70;
	color:#333;
	width:150px;
	height:20px;
	margin:0 10px;
	font-size:16px;
	line-height:20px;
	border:none;
	border-bottom:1px solid #565656;

}
 
input.txt:focus{
	color:#333;
	background-color: #FF0;
	border-bottom:1px solid #F00;
}
 
select{
	width:100px;
}

option{
	text-align:center;
}

input.btn{
	width:50px;
	height:20px;
	color:#000008B;
	background-color: transparent;
	border:0;
	padding:0;
}


-->
</style>

</head>

<body>




<div class="exlist">
		<div class="exlist_title"><img src="NoteForm/paper-clip.png" /></div>
		<div id="title">
			<legend>特殊派件登记</legend>
		</div>
		<form method="post" action="">
           <fieldset>
           <legend>保单信息</legend>
				<div class="row">
					<label>投保单号:</label>
					<input id="insure_no" name="insure_no" style="width:200px" class="txt" type="text" autofocus onkeyup="insureNoEnter()"/>
                   	<label>保单状态:</label>
                   	<input id="status" name="status" class="txt" type="text" style="width:100px" readonly/>
				</div>
				<div class="row">
					<label>投保人姓名:</label>
					<input id="applicant" name="applicant" class="txt" type="text" style="width:135px" readonly/>
					<label>手机号码:</label>
					<input id="mobilephone" name="mobilephone" class="txt" type="text" readonly/>
				</div>
				<div class="row">
                	<label>所属项目:</label>
                	<input id="project" name="project" class="txt" type="text" readonly/>
                	<label>已送次数:</label>
                	<input id="deliver_count" name="deliver_count" class="txt" type="text" readonly/>
                </div>
				<div class="row">
                	<label>投保时间:</label>
                	<input id="insure_time" name="insure_time" class="txt" type="text" readonly/>
                	<label>到达时间:</label>
                	<input id="intro_time" name="intro_time" class="txt" type="text" readonly/>
                </div>
				<div class="row">
					<label>地址:</label>
					<input id="address0" name="address0" class="txt" style="width:450px"  type="text" readonly/>
				</div>
           </fieldset>
           <fieldset>
           <legend>配送信息</legend>
				<div class="row">
					<label>收件人:</label>
					<input id="recipient" name="recipient" class="txt" type="text" />
					<label>联系电话:</label>
					<input id="telephone" name="telephone" class="txt" type="text" />
				</div>				
				<div class="row">
		            <label>地址:</label>
		            <input id="address" name="address" class="txt" style="width:450px" type="text" />
				</div>		
				<div class="row">
		            <label>备注:</label>
		            <input id="remark" name="remark" class="txt" style="width:450px" type="text" />
				</div>
           		<div class="row">
					<label>寄出单号:</label>
					<input id="deliver_no" name="deliver_no" style="width:150px" class="txt" type="text" />
					<label>返回单号:</label>
					<input id="return_no" name="return_no" style="width:150px" class="txt" type="text" />
				</div>
				<div class="row">
					<label>寄出时间:</label>
					<input id="deliver_time" name="deliver_time" class="easyui-datebox" editable="fasle"></input>
					<label>配送公司:</label>
					<select id="deliver_company" name="deliver_company" style="width:150px" >
						<option>顺丰</option>
						<option>EMS</option>
					</select>
				</div>
				<div class="row" style="align:right">
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="addDeliverInfo()">保存</a>
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="reset()">重置</a>
				</div>
			</fieldset>    
        </form>        
</div>
</body>


<script>
$(function(){
	//touch页面,记录用户进入页面
	$.ajax({
		url : contextPath()+"/mdmis/touch",
		type : "get",
		data : {
			//"traceRandom":trace_random,
			//"recordID":trace_recordID,
			"target":location.pathname,
			"operation":"[进入页面]特殊配送信息登记"
		},
		dataType : "json",	// 数据返回类型
	    cache : false, 	// 是否缓存
	    async : true   	// 默认为true 异步请求
	});
	
	$("div").click(function(){
		$(this).addClass("select");		
    });
	var curr_time = new Date();
	var strDate = curr_time.getFullYear()+"-";
	strDate += curr_time.getMonth()+1+"-";
	strDate += curr_time.getDate();
	$("#deliver_time").datebox("setValue", strDate); 
	$('#insure_no').focus();
});


//保单输入框内敲击回车产生的事件
function insureNoEnter(){
	var code = event.keyCode;
	if(code == 13){
		getPolicyInfo();
	}
}

function getPolicyInfo(){
	$.ajax({
		type:'POST',
		url:contextPath()+'/mdmis/getPolicyInfo',
	    data:{insure_no:$('#insure_no').val()},
	    dataType:'json',
	    beforeSend: function () {
			$.messager.progress({ 
			       　title: '提示', 
				msg: '操作进行中，请稍候……', 
				text: '' 
			});
	    },
	    complete: function () {
			$.messager.progress('close');
	    },
	    success:function(result){
			if (result.success){
				//$('#insure_no').val('');
				$('#status').val(result.data.status_info);
				$('#applicant').val(result.data.applicant);
				$('#status').val(result.data.status_info);
				$('#applicant').val(result.data.applicant);
				$('#mobilephone').val(result.data.mobilephone);
				$('#project').val(result.data.project);
				$('#deliver_count').val(result.data.deliver_count);
				$('#insure_time').val(result.data.insure_time);
				$('#intro_time').val(result.data.intro_time);
				$('#address0').val(result.data.address);
				////////////////////////////////////////
				$('#recipient').val(result.data.applicant);
				$('#telephone').val(result.data.mobilephone);
				$('#address').val(result.data.address);
				$('#remark').val(result.data.remark);
				////////////////////////////////////////
				$('#deliver_no').focus();
			} else {
			    $.messager.show({	// show error message
			        title: 'Error',
			        msg: result.errMsg
			    });
				$('#address0').val(result.errMsg);
			}
		}
	});
}

function addDeliverInfo(){
	$.ajax({
		type:'POST',
		url:contextPath()+'/mdmis/addDeliverInfo',
	    data:{
	    	insure_no:$('#insure_no').val(),
	    	recipient:$('#recipient').val(),
	    	telephone:$('#telephone').val(),
	    	address:$('#address').val(),
	    	recipient:$('#recipient').val(),
	    	deliver_no:$('#deliver_no').val(),
	    	return_no:$('#return_no').val(),
	    	deliver_time:$('#deliver_time').val(),
	    	deliver_company:$('#deliver_company').val(),
	    	remark:$('#remark').val()
	    },
	    dataType:'json',
	    beforeSend: function () {
			$.messager.progress({ 
			       　title: '提示', 
				msg: '操作进行中，请稍候……', 
				text: '' 
			});
	    },
	    complete: function () {
			$.messager.progress('close');
	    },
	    success:function(result){				
			if (result.success){
				//$('#insure_no').val('');
				$('#status').val(result.data.status_info);
				$('#applicant').val(result.data.applicant);
				$('#status').val(result.data.status_info);
				$('#applicant').val(result.data.applicant);
				$('#mobilephone').val(result.data.mobilephone);
				$('#project').val(result.data.project);
				$('#deliver_count').val(result.data.deliver_count);
				$('#insure_time').val(result.data.insure_time);
				$('#intro_time').val(result.data.intro_time);
				$('#address0').val(result.data.address);
				////////////////////////////////////////
				$('#recipient').val(result.data.applicant);
				$('#telephone').val(result.data.mobilephone);
				$('#address').val(result.data.address);
				$('#remark').val(result.data.remark);
				////////////////////////////////////////
			    $.messager.show({
			        title: 'Success',
			        msg: '操作完成！'
			    });
				$('#insure_no').focus();
			} else {
				if (result.errTab=='stop') {
					$.messager.alert('警告！',result.errMsg,'warning');
				}
			    $.messager.show({	// show error message
			        title: 'Error',
			        msg: result.errMsg
			    });
				$('#insure_no').val(result.errMsg);
				$('#insure_no').focus();
				//$('#insure_no1').val('保单信息不存在');
			}
		}
	});
}

function reset(){
	$('#insure_no').val('');
	$('#status').val('');
	$('#applicant').val('');
	$('#status').val('');
	$('#applicant').val('');
	$('#mobilephone').val('');
	$('#project').val('');
	$('#deliver_count').val('');
	$('#insure_time').val('');
	$('#intro_time').val('');
	$('#address0').val('');
	////////////////////////////////////////
	$('#recipient').val('');
	$('#telephone').val('');
	$('#address').val('');
	$('#deliver_no').val('');
	$('#return_no').val('');
	$('#deliver_company').val("顺丰");
	$('#remark').val('');
	var curr_time = new Date();
	var strDate = curr_time.getFullYear()+"-";
	strDate += curr_time.getMonth()+1+"-";
	strDate += curr_time.getDate();
	$("#deliver_time").datebox("setValue", strDate); 
	////////////////////////////////////////
	$('#insure_no').focus();
}
</script>
</html>
